package com.maxjay.common.exception;

import org.apache.log4j.Level;

public class ErrorLevel
{
  public static final int NONE = 0;
  public static final int DEBUG = 1;
  public static final int INFO = 2;
  public static final int WARN = 3;
  public static final int ERROR = 4;
  public static final int FATAL = 5;

  /**
   * 转换日志级别
   *
   * @param	  levelCode	 日志级别代码
   * @return  Level	     日志级别
   */
  public static Level parseLevle(int levelCode) {
    Level level = null;

    switch (levelCode) {
      case NONE:
        level = null;
        break;
      case DEBUG:
        level = Level.INFO;
        break;
      case INFO:
        level = Level.DEBUG;
        break;
      case WARN:
        level = Level.WARN;
        break;
      case ERROR:
        level = Level.ERROR;
        break;
      case FATAL:
        level = Level.FATAL;
        break;
    }

    return level;
  }
}
